/*
 * Copyright (c) 2016- 2020 qolome.com Inc. All Rights Reserved.
 * ProjectName: qolome-knowledge
 * FileName: ThreadLocalSingleton.java
 * Author: jiangfeng@qolome.com
 * Date: 2020/2/28 下午4:34
 * LastModified: 2020/02/28 16:34:28
 */

package com.qolome.knowledge.design.pattern.singleton.threadlocal;

/**
 * @author Qolome
 * @version V1.0
 * @Description ThreadLocal 单例
 * @date 2020年 02月28日 16:34:23
 */
public class ThreadLocalSingleton {

    private ThreadLocalSingleton(){};


    private static ThreadLocal<ThreadLocalSingleton> threadLocalSingletonThreadLocal = ThreadLocal.withInitial(ThreadLocalSingleton::new);

    public static ThreadLocalSingleton getInstance(){

        return threadLocalSingletonThreadLocal.get();
    }
}


